import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)
/*1.在地址栏中输入地址
  2. 根据地址在index里找规则
  3.在父容器（app）中配置组件要显示的区域

*/
/*配置路由规则*/
const routes = [
  {
    path:'/',
    component:()=>import("@/views/ComLogin.vue")
  }, {
    path:'/login',
    name:'login',
    component:()=>import("@/views/ComLogin.vue")
  },
  {
    path:'/lay',
    name:'lay',
    component:()=>import("@/components/ComLayout.vue"),
    children:[{ //嵌套路由
      path:'home',
      name:'home',
      component:()=>import("@/views/ComHome.vue")
    }, {
      path:'about',
      name:'about',
      component:()=>import("@/views/ComAbout.vue")
    }]
  }

]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
